﻿using System;

using System.Collections.Generic;
using System.Text;
using System.Net;

namespace Microsoft.Practices.Mobile.DisconnectedAgent.WebService.ConfigurationCredentialService
{
    public class CredentialDictionary 
    {
        Dictionary<string, NetworkCredential> credentialCatalog = new Dictionary<string, NetworkCredential>();

        public NetworkCredential GetCredential(string accountName)
        {
            return credentialCatalog[accountName];
        }

        public void AddCredential(string accountName, string username, string password, string domain)
        {
            if (username != null || password != null || domain != null)
            {
                credentialCatalog.Add(accountName, new NetworkCredential(username, password, domain));
            }
            else
            {
                credentialCatalog.Add(accountName, null);
            }
        }
    }
}
